﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:ProgressBar="clr-namespace:CJToolkit.ProgressBar" xmlns:ImageExtention="clr-namespace:CJToolkit.ImageExtention"
	xmlns:RateControl="clr-namespace:CJToolkit.RateControl" xmlns:InputControl="clr-namespace:CJToolkit.InputControl"
	mc:Ignorable="d">
	<!-- 应该在此定义资源字典条目。-->
    <Style TargetType="ImageExtention:ImageHubTile">
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate>
                    <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Grid.Background>
                            <ImageBrush x:Name="Image" Stretch="UniformToFill" AlignmentX="Left" AlignmentY="Bottom">
                                <ImageBrush.RelativeTransform>
                                    <TranslateTransform x:Name="ViewPortTransform"></TranslateTransform>
                                </ImageBrush.RelativeTransform>
                            </ImageBrush>
                        </Grid.Background>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
	<Style TargetType="ProgressBar:CircleProgressBar">
        <Setter Property="IsLooping" Value="True"/>
        <Setter Property="ArcBackground" Value="Transparent"/>
        <Setter Property="ArcForeground" Value="Red"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Width" Value="100"/>
        <Setter Property="Height" Value="100"/>
        <Setter Property="ArcThickness" Value="20"/>
        <Setter Property="FillRate" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}">
                        <TextBlock x:Name="RateText" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}"  HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed"></TextBlock>
                    	<es:Arc x:Name="BackgroundCircle" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" ArcThicknessUnit="Pixel" StartAngle="0" EndAngle="360" UseLayoutRounding="True"/>
                    	<es:Arc x:Name="ForegroundCircle" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" ArcThicknessUnit="Pixel" UseLayoutRounding="True"/>
                	</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="ProgressBar:LinearProgressBar">
        <Setter Property="IsLooping" Value="True"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="6"/>
        <Setter Property="Foreground" Value="Red"/>
        <Setter Property="FillRate" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border x:Name="Root" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" CornerRadius="3" CacheMode="BitmapCache">
                        <Border x:Name="FillPart" HorizontalAlignment="Left" Height="{TemplateBinding Height}" BorderBrush="{TemplateBinding Foreground}" Background="{TemplateBinding Foreground}" BorderThickness="1" CornerRadius="3" CacheMode="BitmapCache"></Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="ImageExtention:FakeGifBase">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid x:Name="RootElement" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Grid.Background>
                            <ImageBrush x:Name="GifBrush"></ImageBrush>
                        </Grid.Background>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="RateControl:StarRateControl">
        <Setter Property="Foreground" Value="YellowGreen"/>
        <Setter Property="BorderBrush" Value="YellowGreen"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel.Resources>
                            <Style TargetType="es:RegularPolygon" x:Key="RateStar">
                                <Setter Property="Height" Value="24"/>
                                <Setter Property="Width" Value="24"/>
                                <Setter Property="Margin" Value="6"/>
                                <Setter Property="PointCount" Value="5"/>
                                <Setter Property="InnerRadius" Value="0.6"/>
                                <Setter Property="UseLayoutRounding" Value="True"/>
                            </Style>
                        </StackPanel.Resources>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <es:RegularPolygon Style="{StaticResource RateStar}" Stroke="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <es:RegularPolygon Style="{StaticResource RateStar}" Stroke="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <es:RegularPolygon Style="{StaticResource RateStar}" Stroke="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <es:RegularPolygon Style="{StaticResource RateStar}" Stroke="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <es:RegularPolygon Style="{StaticResource RateStar}" Stroke="{TemplateBinding BorderBrush}"/>
                        </Grid>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="RateControl:ProgressRateControl">
        <Setter Property="Foreground" Value="YellowGreen"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="Width" Value="20"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid x:Name="Root">
                        <Grid.Background>
                            <SolidColorBrush Color="Black" Opacity="0"/>
                        </Grid.Background>
                        <ProgressBar:LinearProgressBar x:Name="Progress" Foreground="{TemplateBinding Foreground}" Background="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" IsLooping="False" UseRoundCorner="False"></ProgressBar:LinearProgressBar>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="RateControl:Heart">
        <Setter Property="Foreground" Value="Pink"/>
        <Setter Property="BorderBrush" Value="Red"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}">
                        <Path x:Name="HeartPart" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Foreground}">
                            <Path.Data>
                                <PathGeometry>
                                    <PathFigureCollection x:Name="PathFigureCollection">
                                    </PathFigureCollection>
                                </PathGeometry>
                            </Path.Data>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="RateControl:HeartRateConrtol">
        <Setter Property="Foreground" Value="Pink"/>
        <Setter Property="BorderBrush" Value="Red"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel.Resources>
                            <Style TargetType="RateControl:Heart" x:Key="RateHeart">
                                <Setter Property="Height" Value="24"/>
                                <Setter Property="Width" Value="24"/>
                                <Setter Property="Margin" Value="6"/>
                                <Setter Property="StrokeThickness" Value="1"/>
                                <Setter Property="UseLayoutRounding" Value="True"/>
                            </Style>
                        </StackPanel.Resources>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <RateControl:Heart Style="{StaticResource RateHeart}" Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <RateControl:Heart Style="{StaticResource RateHeart}" Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <RateControl:Heart Style="{StaticResource RateHeart}" Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <RateControl:Heart Style="{StaticResource RateHeart}" Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"/>
                        </Grid>
                        <Grid>
                            <Grid.Background>
                                <SolidColorBrush Color="Black" Opacity="0"/>
                            </Grid.Background>
                            <RateControl:Heart Style="{StaticResource RateHeart}" Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"/>
                        </Grid>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="PhoneDisabledTextBoxTemplate" TargetType="TextBox">
        <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch"/>
    </ControlTemplate>
    <Style TargetType="InputControl:WatermarkTextbox">
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="InputControl:WatermarkTextbox">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledOrReadonlyBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledOrReadonlyBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="DisabledOrReadonlyBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="DisabledOrReadonlyBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="DisabledOrReadonlyContent">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxReadOnlyBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBorderBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="EnabledBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="{StaticResource PhoneTouchTargetOverhang}">
                            <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch"/>
                        </Border>
                        <Border x:Name="DisabledOrReadonlyBorder" BorderBrush="{StaticResource PhoneDisabledBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Margin="{StaticResource PhoneTouchTargetOverhang}" Visibility="Collapsed">
                            <TextBox x:Name="DisabledOrReadonlyContent" Background="Transparent" Foreground="{StaticResource PhoneDisabledBrush}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" IsReadOnly="True" SelectionForeground="{TemplateBinding SelectionForeground}" SelectionBackground="{TemplateBinding SelectionBackground}" TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding Text}" Template="{StaticResource PhoneDisabledTextBoxTemplate}"/>
                        </Border>
                        <Grid>
                            <TextBlock x:Name="Watermark" IsHitTestVisible="False" TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}" Margin="18,19"></TextBlock>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="RateControl:Cross">
        <Setter Property="Width" Value="40"/>
        <Setter Property="Height" Value="50"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <es:RegularPolygon x:Name="CrossPart" UseLayoutRounding="True" InnerRadius="0.3" PointCount="4" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Fill="{TemplateBinding Foreground}" Stroke="{TemplateBinding BorderBrush}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="RateControl:SparkingCross">
        <Setter Property="Width" Value="40"/>
        <Setter Property="Height" Value="50"/>
        <Setter Property="LightBrush" Value="#FFFFFFFF"/>
        <Setter Property="DarkBrush" Value="#FF353535"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <RateControl:Cross x:Name="CrossPart" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" BorderBrush="{TemplateBinding BorderBrush}">
                    </RateControl:Cross>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>